﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Expression.Interactivity;
using System.Windows.Interactivity;
using Microsoft.Devices.Sensors;
using Microsoft.Xna.Framework;
using System.Windows.Threading;

namespace girapong
{
    public class bar
    {
        public static int LYING = 1;
        public static int STAND = 2;
        public static double WIDTH_DEFAULT = 120;
        public static double HEIGHT_DEFAULT = 30;
        public System.Windows.Shapes.Rectangle rectangle { get; set; }

        public bar(System.Windows.Media.Color color, int x0, int y0) :
            this(color, (double)x0, (double)y0)
        {
        }
        public bar(System.Windows.Media.Color color, double x0, double y0)
        {
            rectangle = new System.Windows.Shapes.Rectangle();
            rectangle.Fill = new SolidColorBrush(color);
            rectangle.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            rectangle.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            rectangle.Margin = new Thickness(x0, y0, 0, 0);
            rectangle.Width = WIDTH_DEFAULT;
            rectangle.Height = HEIGHT_DEFAULT;
        }

        public void move(double x, double y)
        {
            rectangle.Margin = new Thickness(x, y, 0, 0);
        }
        public void turnBarPerpendicularly(int pos)
        {
            if (pos == STAND)
            {
                rectangle.Width = HEIGHT_DEFAULT;
                rectangle.Height = WIDTH_DEFAULT;
            }
            else
            {
                rectangle.Width = WIDTH_DEFAULT;
                rectangle.Height = HEIGHT_DEFAULT;
            }
        }

    }
}
